<template>
  <view class="listBox">
    <view v-if="list.length && type == 1">
      <view v-for="(item, i) in list" :key="i" class="box">
        <view class="m">
          <view class="point" />
          <view class="first l">
            <view class="k">
              <view class="value">{{ item?.name }} </view>
            </view>
          </view>

          <view class="first">
            <view class="k">
              <view class="name">标价(元)：</view>
              <view class="value">{{ item?.price }} </view>
            </view>
            <view class="k">
              <view class="name">售价(元)：</view>
              <view class="value">{{ item?.amt }} </view>
            </view>
          </view>
        </view>
      </view>
    </view>
    <view v-else-if="list.length && type == 2">
      <view class="box" v-for="(item, i) in list" :key="i">
        <view class="m">
          <view class="point" />
          <view class="first l">
            <view class="k">
              <view class="value"
                >{{ $util.selectDictLabel(payType, item?.type) }}
              </view>
            </view>
          </view>

          <view class="first">
            <view class="k">
              <view class="name">支付(元)：</view>
              <view class="value">{{ item?.amt }} </view>
            </view>
            <view class="k">
              <view class="name">余额(元)：</view>
              <view class="value">{{ item?.balance }} </view>
            </view>
          </view>
        </view>
      </view>
    </view>
    <view v-else class="uni-nodata">暂无数据!</view>
  </view>
</template>

<script>
import _ from 'lodash';
import ListScrollView from '@/components/ListScrollView/index.vue';
export default {
  components: {
    ListScrollView,
  },
  props: {
    list: {
      type: Array,
      default: () => [],
    },
    type: {
      type: Number,
      default: 1,
    },
  },
  data() {
    return {
      payType: [
        {
          text: '卡付',
          label: '卡付',
          value: 1,
        },
        {
          text: '现金',
          label: '现金',
          value: 2,
        },
        {
          text: '银联',
          label: '银联',
          value: 3,
        },
        {
          text: '主账户',
          label: '主账户',
          value: 11,
        },
        {
          text: '补贴账户',
          label: '补贴账户',
          value: 21,
        },
        {
          text: '扫码支付',
          label: '扫码支付',
          value: 30,
        },
        {
          text: '微信',
          label: '微信',
          value: 31,
        },
        {
          text: '支付宝',
          label: '支付宝',
          value: 32,
        },
      ],
      // 重复点击，使用noMultipleClicks方法时，需要在当前页面创建此变量
      noClick: true,
    };
  },
  onLoad(query) {},
  onShow() {},
  methods: {},
};
</script>

<style lang="scss" scoped>
.listBox {
  width: 100%;
  height: 60vh;
  flex: 1 1 auto;
  position: relative;
  .box {
    width: 85%;
    line-height: 1;
    padding: 26rpx 34rpx 32rpx;
    background: #ffffff;
    border-radius: 20rpx;
    box-shadow: 0rpx 4rpx 17rpx 0rpx rgba(0, 0, 0, 0.06);
    letter-spacing: 4rpx;
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 auto;
    .m {
      width: 100%;
      display: flex;
      align-items: center;
      padding-left: 20rpx;
      .point {
        position: absolute;
        left: 20rpx;
        width: 18rpx;
        height: 18rpx;
        margin-right: 20rpx;
        border-radius: 50%;
        background: #67c23a;
      }
      .first {
        &.l {
          width: 40%;
        }
        .k {
          display: flex;
          align-items: center;
          justify-content: space-between;
          .name {
            font-size: 28rpx;
            line-height: 33rpx;
          }
          .value {
            font-size: 28rpx;
            color: #989898;
            line-height: 33rpx;
            text-align: right;
          }
        }
      }
    }
  }
}
</style>
